﻿<%@ Page Title="修改基本信息" Language="C#" MasterPageFile="~/resumemanager/resume.master" Inherits="WebManager.BasePage" %>
<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="TalentPools.Model" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<script runat="server">
    string username;
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
             //构造简历对象
            //构造简历对象
            resume resume = new resume();
            resume.Id = Convert.ToInt32(Session["resumeId"]);
            resume.resumeName = txtresumename.Text.Trim();
            resume.username = username;
            resume.name = txtrealname.Text.Trim();
            resume.sex = rblsex.SelectedValue;
            resume.birthday = Convert.ToDateTime(txtbirthday.Text.Trim());
            resume.marriage = ddlmarriagestate.SelectedValue;
            resume.card = txtidcard.Text.Trim();
            resume.politicsStatus = ddlzzmianmao.SelectedValue;
            resume.HKPlace = txthlplace.Text.Trim();
            resume.city = txtcurrentcity.Text.Trim();
            resume.currentAddress = txtaddress.Text.Trim();
            resume.zipCode = txtyzbm.Text.Trim();
            resume.cellphone = txtmobile.Text.Trim();
            resume.phoneCode = txttellphone.Text.Trim();
            resume.email = txtemail.Text.Trim();
            resume.homePage = txtpage.Text.Trim();
            resume.workYear = ddlworkyear.SelectedValue;
            resume.lastUpdateTime = DateTime.Now;
            if (rbresumestate.SelectedValue == "1")
            {
                resume.isPublic = true;
            }
            else
            {
                resume.isPublic = false;
            }
            if (new alertResumeManager().updatResumeByid(resume))
            {
                lblbasemean.Text = "修改成功！";
            }
            else
            {
                lblbasemean.Text = "修改失败，如果信息填写无误，请联系管理员解决！";
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!MyUserLogin())
        {
            JsWindows("Cookie已经过期，请先登录", "../Index.aspx");
            return;
        }
        username = Server.UrlDecode(Request.Cookies["User"].Values["name"]);
        if (!IsPostBack)
        {
            this.txtbirthday.Attributes.Add("ReadOnly", "true");
            ViewState["resumeId"] = Request.QueryString["resumeId"];//获取简历ID
            BindData();
            List<resume> list = new alertResumeManager().GetResumeId(Convert.ToInt32(Session["resumeId"]));
            if (list.Count == 1)
            {
                resume r = list[0];
                txtresumename.Text = r.resumeName;
                txtrealname.Text = r.name;
                rblsex.SelectedValue = r.sex;
                txtbirthday.Text = r.birthday.ToShortDateString();
                ddlworkyear.SelectedValue = r.workYear;
                ddlmarriagestate.SelectedValue = r.marriage;
                txtidcard.Text = r.card;
                ddlzzmianmao.SelectedValue = r.politicsStatus;
                txthlplace.Text = r.HKPlace;
                txtcurrentcity.Text = r.city;
                txtaddress.Text = r.currentAddress;
                txtyzbm.Text = r.zipCode;
                txtmobile.Text = r.cellphone;
                txttellphone.Text = r.phoneCode;
                txtemail.Text = r.email;
                txtpage.Text = r.homePage;
            }
        }
    }

    private void BindData()
    {

        ddlmarriagestate.DataSource = new baseConfigManager().getconfigInfo("婚姻状态");
        ddlmarriagestate.DataTextField = "value";
        ddlmarriagestate.DataValueField = "value";
        ddlmarriagestate.DataBind();

        ddlworkyear.DataSource = new baseConfigManager().getconfigInfo("工作时间");
        ddlworkyear.DataTextField = "value";
        ddlworkyear.DataValueField = "value";
        ddlworkyear.DataBind();

        ddlzzmianmao.DataSource = new baseConfigManager().getconfigInfo("政治面貌");
        ddlzzmianmao.DataTextField = "value";
        ddlzzmianmao.DataValueField = "value";
        ddlzzmianmao.DataBind();
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager runat="server">
    </asp:ScriptManager>
    <table width='100%' border='0' align='center' cellpadding='4' cellspacing='1' class='border'>
        <tr class='tdbg'>
            <td colspan="2" class="topbg2">
                <div align="center" class="Glow">
                    <strong>基 本 资 料</strong></div>
            </td>
        </tr>
        <tr class='tdbg'>
            <td width="23%" class="tdbg1">
                <div align="right">
                    <span class="style4">*</span>简历名称：</div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <input type="hidden" name="position" />
                <asp:TextBox ID="txtresumename" runat="server"></asp:TextBox><span class="style4">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtresumename"
                        runat="server" ErrorMessage="请填写简历名称" SetFocusOnError="True"></asp:RequiredFieldValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td width="23%" class="tdbg1">
                <div align="right">
                    <span class="style4">*</span>姓名：</div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:TextBox ID="txtrealname" runat="server"></asp:TextBox><span class="style4"><asp:RequiredFieldValidator
                    ID="RequiredFieldValidator2" ControlToValidate="txtrealname" runat="server" ErrorMessage="请填写姓名"></asp:RequiredFieldValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    性别：</div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:RadioButtonList ID="rblsex" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                    <asp:ListItem Value="男" Text="男" Selected="True"></asp:ListItem>
                    <asp:ListItem Value="女" Text="女"></asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    出生日期：</div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:TextBox ID="txtbirthday" runat="server" Width="150px"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender1" TargetControlID="txtbirthday" runat="server">
                </asp:CalendarExtender>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        工作时间：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:DropDownList ID="ddlworkyear" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        婚姻状态：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:DropDownList ID="ddlmarriagestate" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        身份证号：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:TextBox ID="txtidcard" runat="server" MaxLength="20"></asp:TextBox>
                <span class="style4">
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ControlToValidate="txtidcard"
                        runat="server" ErrorMessage="身份证格式不正确" ValidationExpression="\d{17}[\d|X]|\d{15}"></asp:RegularExpressionValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        政治面貌：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:DropDownList ID="ddlzzmianmao" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        户口所在地：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:TextBox ID="txthlplace" runat="server" MaxLength="50"></asp:TextBox>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <div align="right">
                        现居住城市：</div>
                </div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:TextBox ID="txtcurrentcity" runat="server" MaxLength="50"></asp:TextBox>
            </td>
        </tr>
        <tr class='tdbg'>
            <td width="23%" class="tdbg1">
                <div align="right">
                    邮政编码：</div>
            </td>
            <td width="77%" class="tdbg2">
                <asp:TextBox ID="txtyzbm" runat="server"></asp:TextBox>
                <span class="style4">
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="邮政编码格式不正确"
                        ControlToValidate="txtyzbm" ValidationExpression="\d{6}"></asp:RegularExpressionValidator>
                </span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    手机号码：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtmobile" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    固话：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txttellphone" runat="server"></asp:TextBox>
                <span class="style4">
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ErrorMessage="电话格式不正确"
                        ControlToValidate="txttellphone" ValidationExpression="(\(\d{3}\)|\d{3}-)?\d{8}"></asp:RegularExpressionValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    <span class="style4"></span>电子邮箱：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtemail" runat="server"></asp:TextBox>
                <span class="style4">
                    <asp:RegularExpressionValidator ControlToValidate="txtemail" ID="RegularExpressionValidator1"
                        runat="server" ErrorMessage="邮箱格式不正确" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    联系地址：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtaddress" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    个人主页：</div>
            </td>
            <td class="tdbg2">
                <asp:TextBox ID="txtpage" runat="server"></asp:TextBox>
                <span class="style4">
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ErrorMessage="输入的网址格式不正确"
                        ControlToValidate="txtpage" ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?"></asp:RegularExpressionValidator></span>
            </td>
        </tr>
        <tr class='tdbg'>
            <td class="tdbg1">
                <div align="right">
                    简历状态：</div>
            </td>
            <td class="tdbg2" style="width: 482px">
                <asp:RadioButtonList ID="rbresumestate" runat="server" RepeatDirection="Horizontal"
                    RepeatLayout="Flow">
                    <asp:ListItem Value="1" Text="公开"></asp:ListItem>
                    <asp:ListItem Value="0" Text="不公开" Selected="True"></asp:ListItem>
                </asp:RadioButtonList>
                <span class="style4">&nbsp;注意：只能公开一份简历，如果此份简历被公开，其他简历将被屏蔽</apan>
            </td>
        </tr>
    </table>
    <br />
    <table width="100%" border="0">
        <tr>
            <td>
                <div align="center">
                    &nbsp;<asp:Button ID="btnSubmit" runat="server" Text="提 交" OnClick="btnSubmit_Click" />&nbsp;
                    <label>
                        <input type="reset" name="Submit2" value="重 置" /><br />
                        <asp:Label ID="lblbasemean" runat="server" ForeColor="Red"></asp:Label></label></div>
            </td>
        </tr>
    </table>
</asp:Content>
